package com.xuyixuan.database_midware_study.Service;

import com.xuyixuan.database_midware_study.DAO.UserDao;
import com.xuyixuan.database_midware_study.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {

    @Autowired
    private UserDao userDao;

    public int addUser(User user) {
        return userDao.addUser(user);
    }

    public User getUserById(int id) {
        return userDao.getUserById(id);
    }

    public int updateUser(User user) {
        return userDao.updateUser(user);
    }

    public int deleteUser(int id) {
        return userDao.deleteUser(id);
    }

    public List<User> getAllUsers() {
        return userDao.getAllUsers();
    }
}